package com.fr.data.core.db;

import com.fr.base.BaseUtils;
import com.fr.base.FRContext;
import com.fr.util.Utils;
import java.awt.Image;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.logging.Level;
import java.util.logging.Logger;

public class BinaryObject
{
  private byte[] bytes;

  public BinaryObject(byte[] paramArrayOfByte)
  {
    this.bytes = paramArrayOfByte;
  }

  public InputStream getInputStream()
  {
    return new ByteArrayInputStream(this.bytes);
  }

  public Object getValue()
  {
    return Utils.inputStream2Object(getInputStream());
  }

  public Image getImage()
  {
    try
    {
      return BaseUtils.readImage(getInputStream());
    }
    catch (IOException localIOException)
    {
      FRContext.getLogger().log(Level.WARNING, localIOException.getMessage(), localIOException);
    }
    return null;
  }

  public byte[] getBytes()
  {
    return this.bytes;
  }
}